setInsetsAndAlpha

open fun setInsetsAndAlpha(@Nullable insets: Insets, @FloatRange(from = 0.0, to = 1.0) alpha: Float, @FloatRange(from = 0.0, to = 1.0) fraction: Float)(source)

Modifies the insets for the frame being drawn by indirectly moving the windows around in the system that are causing window insets.

Note that these insets are always relative to the window, which is the same as being relative to getRootView

Also note that this will not inform the view system of a full inset change via dispatchApplyWindowInsets in order to avoid a full layout pass during the animation. If you'd like to animate views during a window inset animation, register a WindowInsetsAnimationCompat.Callback by calling setWindowInsetsAnimationCallback that will be notified about any insets change via onProgress during the animation.

dispatchApplyWindowInsets will instead be called once the animation has finished, i.e. once finish has been called. Note: If there are no insets, alpha animation is still applied.

Parameters

insets

The new insets to apply. Based on the requested insets, the system will calculate the positions of the windows in the system causing insets such that the resulting insets of that configuration will match the passed in parameter. Note that these insets are being clamped to the range from getHiddenStateInsets to getShownStateInsets. If you intend on changing alpha only, pass null or getCurrentInsets.

alpha

The new alpha to apply to the inset side.

fraction

instantaneous animation progress. This value is dispatched to WindowInsetsAnimationCompat.Callback.

See also